package com.jio.mapper;

import com.jio.entity.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleMapper {

    @Select("select * from role")
    List<Role> findAll();

    @Insert("insert into role(roleName,roleDesc) values(#{roleName},#{roleDesc})")
    void insert(Role role);

    @Delete("delete from role where id = #{id}")
    void deleteById(int id);

    Role selectRole_Permission(int id);

    @Insert("update role set roleName = #{roleName},roleDesc = #{roleDesc} where id = #{id}")
    int update(Role role);

    int insertR_P(@Param("rid") int rid, @Param("ids") List<Integer> ids);
    @Delete("delete from role_permission where roleId=#{id}")
    int deleteR_P(int id);
}
